package org.easy.tool.controller;

import org.easy.tool.common.R;
import org.easy.tool.common.WebUtil;
import org.easy.tool.service.IUserDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Valley
 * @since 2025-07-19 18:57:11
 */
@RestController
@RequestMapping("/userDetail")
public class UserDetailController {

    @Autowired
    IUserDetail service;


    @RequestMapping("getUserTagList")
    public R getUserTagList(@RequestBody(required = false) LinkedHashMap data) throws Exception {
        return R.ok(service.getUserTagList(data));
    }

    @RequestMapping("updateUserTagList")
    public R updateUserTagList(@RequestBody(required = false)LinkedHashMap data) throws Exception {
        return R.ok(service.updateUserTagList(data));
    }

    @RequestMapping("markUserProblemDetail")
    public R markUserProblemDetail(@RequestBody(required = false)LinkedHashMap data) throws Exception {
        String userId = WebUtil.getUserId();
        String problemId = (String) data.get("problemId");
        String type = (String) data.get("type");
        return R.ok(service.markUserProblemDetail(userId, problemId, type));
    }

}
